package com.fc.primary.stack;

import com.fc.primary.queue.MyQueue;

/**
 * @program: fc-java->TestStack
 * @description: 测试栈
 * @author: G_Y
 * @create: 2019-09-01 19:17
 **/
public class TestStack {
    public static void main(String[] args) {
        MyStack<String> stringMyQueue = new MyStack<>(4);
        stringMyQueue.push("1");
        stringMyQueue.push("2");
        stringMyQueue.push("3");
        stringMyQueue.push("4");
        f(stringMyQueue);

        stringMyQueue.push("5");
        stringMyQueue.push("6");
        stringMyQueue.push("7");
        stringMyQueue.push("8");
        f(stringMyQueue);

        stringMyQueue.push("9");
        System.out.println("当前栈元素量" + stringMyQueue.size());
        System.out.println("出栈元素" + stringMyQueue.pop());
        System.out.println("当前栈元素量" + stringMyQueue.size());


    }

    private static void f(MyStack<String> myStack) {
        System.out.println("当前栈元素量" + myStack.size());
        System.out.println("出栈元素" + myStack.pop());
        System.out.println("出栈元素" + myStack.pop());
        System.out.println("出栈元素" + myStack.pop());
        System.out.println("出栈元素" + myStack.pop());
        System.out.println("当前栈元素量" + myStack.size());
    }
}
